using TMPro;
using UnityEngine;

public class BlackholeHotkey : MonoBehaviour
{
    private SpriteRenderer sr;
    private KeyCode myHotkey;
    private TextMeshProUGUI myText;
    private Transform enemy;
    private BlackholeSkill blackholeSkillControlloer;

    private void Awake()
    {
        sr = GetComponent<SpriteRenderer>();
        myText = GetComponentInChildren<TextMeshProUGUI>();
    }

    public void SetupHotkey(KeyCode myHotkey, Transform enemy, BlackholeSkill blackholeSkillControlloer)
    {
        this.enemy = enemy;
        this.blackholeSkillControlloer = blackholeSkillControlloer;
        this.myHotkey = myHotkey;
        myText.text = myHotkey.ToString();
    }

    private void Update()
    {
        if(Input.GetKeyDown(myHotkey))
        {
            blackholeSkillControlloer.AddEnemyToList(enemy);
            myText.color = Color.clear;
            sr.color = Color.clear;
        }
    }
}
